package com.yequan.designpattern.proxy.third_generation;

public class ThirdGenerationTest {

    public static void main(String[] args) {

        //正确调用,只能通过代理调用
        IGamePlayer2 gamePlayer = new GamePlayer("叶权");
        IGamePlayer2 gamePlayerProxy = gamePlayer.getProxy();
        gamePlayerProxy.login("yequan","1");
        gamePlayerProxy.killBoss();
        gamePlayerProxy.upgrade();

        //错误调用示例:直接访问真实角色
//        IGamePlayer2 gamePlayer = new GamePlayer("叶权");
//        gamePlayer.login("yequan","1");
//        gamePlayer.killBoss();
//        gamePlayer.upgrade();

        //错误调用示例:直接访问代理类
//        IGamePlayer2 gamePlayer = new GamePlayer("叶权");
//        GamePlayerProxy gamePlayerProxy = new GamePlayerProxy(gamePlayer);
//        gamePlayerProxy.login("yequan","1");
//        gamePlayerProxy.killBoss();
//        gamePlayerProxy.upgrade();
    }

}
